<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="手机号" prop="phoneNumber">
        <el-input
          v-model="queryParams.phoneNumber"
          placeholder="请输入手机号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="咨询人员" prop="consultant">
        <el-input
          v-model="queryParams.consultant"
          placeholder="请输入咨询人员"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="归属校区" prop="belongingToCampus">
        <el-input
          v-model="queryParams.belongingToCampus"
          placeholder="请输入归属校区"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="来源" prop="source">
        <el-input
          v-model="queryParams.source"
          placeholder="请输入来源"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毕业大学" prop="graduationFromUniversity">
        <el-input
          v-model="queryParams.graduationFromUniversity"
          placeholder="请输入毕业大学"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="跟踪次数" prop="trackingTimes">
        <el-input
          v-model="queryParams.trackingTimes"
          placeholder="请输入跟踪次数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['custom:tracking:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['custom:tracking:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['custom:tracking:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['custom:tracking:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="following"
          v-hasPermi="['custom:tracking:following']"
        >跟踪</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="trackingList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="潜在客户ID" align="center" prop="id" />
      <el-table-column label="姓名" align="center" prop="name" >
        <template slot-scope="scope">
          <span @click="openDrawer(scope.row)">{{ (scope.row.name) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="微信" align="center" prop="wechat" />
      <el-table-column label="QQ" align="center" prop="qq" />
      <el-table-column label="手机号" align="center" prop="phoneNumber" />
      <el-table-column label="性别" align="center" prop="gender" />
      <el-table-column label="意向学科" align="center" prop="intendedSubject" />
      <el-table-column label="意向程度" align="center" prop="interestLevel" />
      <el-table-column label="录入人" align="center" prop="inputterTeacher" />
      <el-table-column label="咨询人员" align="center" prop="consultant" />
      <el-table-column label="录入时间" align="center" prop="inputTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.inputTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最后跟踪时间" align="center" prop="lastFollowUpTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastFollowUpTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="意向班级" align="center" prop="intendedClass" />
      <el-table-column label="来源" align="center" prop="source" />
      <el-table-column label="学历" align="center" prop="education" />
      <el-table-column label="毕业大学" align="center" prop="graduationFromUniversity" />
      <el-table-column label="毕业时间" align="center" prop="graduationTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.graduationTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="老学员推荐(0不是,1是)" align="center" prop="reference" />
      <el-table-column label="老学员" align="center" prop="seniorStudents" />
      <el-table-column label="专业" align="center" prop="speciality" />
      <el-table-column label="工作年限" align="center" prop="yearsOfService" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.yearsOfService, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="当前状态(0在读,1在工作,2赋闲在家)" align="center" prop="currentState" />
      <el-table-column label="下次跟进时间" align="center" prop="nextFollowUptime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.nextFollowUptime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="跟踪次数" align="center" prop="trackingTimes" />
      <el-table-column label="归属校区" align="center" prop="belongingToCampus" />
      <el-table-column label="最近跟踪记录" align="center" prop="trackRecord" />
      <el-table-column label="未跟踪时间" align="center" prop="untracedTime" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['custom:tracking:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['custom:tracking:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改学员跟踪对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="年龄" prop="age">
          <el-input v-model="form.age" placeholder="请输入年龄" />
        </el-form-item>
        <el-form-item label="微信" prop="wechat">
          <el-input v-model="form.wechat" placeholder="请输入微信" />
        </el-form-item>
        <el-form-item label="QQ" prop="qq">
          <el-input v-model="form.qq" placeholder="请输入QQ" />
        </el-form-item>
        <el-form-item label="手机号" prop="phoneNumber">
          <el-input v-model="form.phoneNumber" placeholder="请输入手机号" />
        </el-form-item>
        <el-form-item label="意向学科" prop="intendedSubject">
          <el-input v-model="form.intendedSubject" placeholder="请输入意向学科" />
        </el-form-item>
        <el-form-item label="录入人" prop="inputterTeacher">
          <el-input v-model="form.inputterTeacher" placeholder="请输入录入人" />
        </el-form-item>
        <el-form-item label="咨询人员" prop="consultant">
          <el-input v-model="form.consultant" placeholder="请输入咨询人员" />
        </el-form-item>
        <el-form-item label="录入时间" prop="inputTime">
          <el-date-picker clearable
            v-model="form.inputTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择录入时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最后跟踪时间" prop="lastFollowUpTime">
          <el-date-picker clearable
            v-model="form.lastFollowUpTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择最后跟踪时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="意向班级" prop="intendedClass">
          <el-input v-model="form.intendedClass" placeholder="请输入意向班级" />
        </el-form-item>
        <el-form-item label="来源" prop="source">
          <el-input v-model="form.source" placeholder="请输入来源" />
        </el-form-item>
        <el-form-item label="学历" prop="education">
          <el-input v-model="form.education" placeholder="请输入学历" />
        </el-form-item>
        <el-form-item label="毕业大学" prop="graduationFromUniversity">
          <el-input v-model="form.graduationFromUniversity" placeholder="请输入毕业大学" />
        </el-form-item>
        <el-form-item label="毕业时间" prop="graduationTime">
          <el-date-picker clearable
            v-model="form.graduationTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择毕业时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="老学员推荐(0不是,1是)" prop="reference">
          <el-input v-model="form.reference" placeholder="请输入老学员推荐(0不是,1是)" />
        </el-form-item>
        <el-form-item label="老学员" prop="seniorStudents">
          <el-input v-model="form.seniorStudents" placeholder="请输入老学员" />
        </el-form-item>
        <el-form-item label="专业" prop="speciality">
          <el-input v-model="form.speciality" placeholder="请输入专业" />
        </el-form-item>
        <el-form-item label="工作年限" prop="yearsOfService">
          <el-input v-model="form.yearsOfService" placeholder="请输入专业" />
        </el-form-item>

        <el-form-item label="当前状态(0在读,1在工作,2赋闲在家)" prop="currentState">
          <el-input v-model="form.currentState" placeholder="请输入当前状态(0在读,1在工作,2赋闲在家)" />
        </el-form-item>
        <el-form-item label="下次跟进时间" prop="nextFollowUptime">
          <el-date-picker clearable
            v-model="form.nextFollowUptime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择下次跟进时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="跟踪次数" prop="trackingTimes">
          <el-input v-model="form.trackingTimes" placeholder="请输入跟踪次数" />
        </el-form-item>
        <el-form-item label="归属校区" prop="belongingToCampus">
          <el-input v-model="form.belongingToCampus" placeholder="请输入归属校区" />
        </el-form-item>
        <el-form-item label="最近跟踪记录" prop="trackRecord">
          <el-input v-model="form.trackRecord" placeholder="请输入最近跟踪记录" />
        </el-form-item>
        <el-form-item label="未跟踪时间" prop="untracedTime">
          <el-input v-model="form.untracedTime" placeholder="请输入未跟踪时间" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>



    <!-- 跟踪学员表 -->
    <el-dialog :title="title" :visible.sync="open3" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" class="row-flex">
        <el-form-item label="姓名" prop="name" class="flex-item" >
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="联系电话" prop="phoneNumber" class="flex-item">
          <el-input v-model="form.phoneNumber" placeholder="请输入联系电话" />
        </el-form-item>
        <el-form-item label="QQ" prop="qq" class="flex-item">
          <el-input v-model="form.qq" placeholder="请输入QQ" />
        </el-form-item>
        <el-form-item label="微信" prop="wechat" class="flex-item">
          <el-input v-model="form.wechat" placeholder="请输入微信" />
        </el-form-item>
        <el-form-item label="意向程度" prop="interestLevel" class="flex-item">
          <el-select v-model="form.interestLevel" placeholder="请输入意向程度" style="width: 300px;">
            <el-option label="高" value="High"></el-option>
            <el-option label="中" value="Medium"></el-option>
            <el-option label="低" value="Low"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="意向班级" prop="intendedClass" class="flex-item">
          <el-input v-model="form.intendedClass" placeholder="请输入意向班级" />
        </el-form-item>
        <el-form-item label="跟进目的" prop="followUpPurpose" class="flex-item">
          <el-select v-model="form.followUpPurpose" placeholder="请选择跟进目的" style="width: 300px">
            <el-option label="潜在学员跟进" value="潜在学员跟进"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="跟进方式" prop="followUpMethod" class="flex-item">
          <el-select v-model="form.followUpMethod" placeholder="请选择跟进方式" style="width: 300px;">
            <el-option label="QQ" value="QQ"></el-option>
            <el-option label="微信" value="微信"></el-option>
            <el-option label="电话" value="电话"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否联系上" prop="whetherToContact" class="flex-item">
          <el-select v-model="form.contacte" placeholder="请选择是否联系上" style="width: 300px">
            <el-option label="是" value="1"></el-option>
            <el-option label="否" value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="下次跟进时间" prop="nextFollowupTime" >
          <el-date-picker clearable
                          v-model="form.nextFollowUptime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择下次跟进时间"
                          style="width: 300px">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="摘要" prop="abstract" style="width: 100%">
          <el-input type="textarea" v-model="form.remarks" placeholder="请输入摘要" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm3">确 定</el-button>
        <el-button @click="cancel3">取 消</el-button>
      </div>
    </el-dialog>

    <el-drawer
      :title="potentialStudentInformationList.name"
      :visible.sync="drawerStudentInformation.visible"
      width="100%">
      <!-- 抽屉内部内容，可以根据获取的数据动态填充 -->
      <div v-if="drawerStudentInformation.selectedRow !== null" >
        <template>
          <el-tabs v-model="activeName" style="margin-left: 3%" >
            <el-tab-pane label="基本信息" name="first">
              <el-row>
                <el-col :span="12">建档时间:{{ potentialStudentInformationList.inputTime }}</el-col>
                <el-col :span="12">咨询人:{{ potentialStudentInformationList.consultant }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">姓名:{{ potentialStudentInformationList.name }}</el-col>
                <el-col :span="12">性别:{{ potentialStudentInformationList.gender }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">年龄:{{ potentialStudentInformationList.age }}</el-col>
                <el-col :span="12">来源:{{ potentialStudentInformationList.source }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">当前状态:{{ potentialStudentInformationList.currentState }}</el-col>
                <el-col :span="12">联系电话:{{ potentialStudentInformationList.phoneNumber }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">QQ:{{ potentialStudentInformationList.qq }}</el-col>
                <el-col :span="12">微信:{{ potentialStudentInformationList.wechat }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">专业:{{ potentialStudentInformationList.speciality }}</el-col>
                <el-col :span="12">学历:{{ potentialStudentInformationList.education }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">毕业院校:{{ potentialStudentInformationList.graduationFromUniversity }}</el-col>
                <el-col :span="12">毕业时间:{{ potentialStudentInformationList.graduationTime }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">意向程度:{{ potentialStudentInformationList.interestLevel }}</el-col>
                <el-col :span="12">意向班级:{{ potentialStudentInformationList.intendedClass }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">工作年限:{{ potentialStudentInformationList.yearsOfService }}</el-col>
                <el-col :span="12">意向学科:{{ potentialStudentInformationList.intendedSubject }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">是否老学员推荐:{{ potentialStudentInformationList.recommended }}</el-col>
                <el-col :span="12">介绍人:{{ potentialStudentInformationList.seniorStudents }}</el-col>
              </el-row>
              <el-row style="margin-top: 2%">
                <el-col :span="12">录入人:{{ potentialStudentInformationList.inputterTeacher }}</el-col>
                <el-col :span="12">备注:{{ potentialStudentInformationList.remark }}</el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="跟踪记录" name="second">
              <el-table v-loading="loading" :data="studentTrackingList" border >
                <el-table-column type="index" :index="1" align="center" label="序号" width="50px"></el-table-column>
                <el-table-column property="lastFollowUpTime"align="center" label="跟踪时间" show-overflow-tooltip width="140px">
                  <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.lastFollowUpTime, '{y}-{m}-{d}') }}</span>
                  </template>
                </el-table-column>
                <el-table-column property="consultant" align="center" label="跟踪人员"></el-table-column>
                <el-table-column property="followUpMethod" align="center" label="跟踪方式"></el-table-column>
                <el-table-column property="intentionLevel" align="center" label="意向程度"></el-table-column>
                <el-table-column property="contacte" align="center" label="是否联系上" width="100px"></el-table-column>
                <el-table-column property="remarks" align="center" label="摘要"></el-table-column>
              </el-table>
            </el-tab-pane>
            <el-tab-pane label="潜在学员动态" name="third"></el-tab-pane>
          </el-tabs>
        </template>
      </div>
    </el-drawer>


  </div>
</template>

<script>
import {
  listTracking,
  getTracking,
  delTracking,
  addTracking,
  updateTracking,
  updatesmTracking
} from "@/api/custom/tracking";

export default {
  name: "Tracking",
  data() {
    return {
      activeName: 'first',
      studentTrackingList: [],
      drawerStudentInformation:{
        visible: false,
        selectedRow:null
      },
      potentialStudentInformationList: {},
      open3:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 学员跟踪表格数据
      trackingList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        age: null,
        wechat: null,
        qq: null,
        phoneNumber: null,
        gender: null,
        intendedSubject: null,
        interestLevel: null,
        inputterTeacher: null,
        consultant: null,
        inputTime: null,
        lastFollowUpTime: null,
        intendedClass: null,
        source: null,
        education: null,
        graduationFromUniversity: null,
        graduationTime: null,
        reference: null,
        seniorStudents: null,
        speciality: null,
        yearsOfService: null,
        currentState: null,
        nextFollowUptime: null,
        trackingTimes: null,
        belongingToCampus: null,
        trackRecord: null,
        untracedTime: null,
        remarks:null,
        followUpPurpose:null,
        followUpMethod:null,
        contacte:null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        inputTime: [
          { required: true, message: "录入时间不能为空", trigger: "blur" }
        ],
        lastFollowUpTime: [
          { required: true, message: "最后跟踪时间不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {

    openDrawer(row){
      console.log(row);
      this.drawerStudentInformation.visible=true;
      this.drawerStudentInformation.selectedRow =row;
      getTracking(row.id).then(response=>{

        console.log(response)
        this.potentialStudentInformationList=response.data;
       //
      });
      this.queryParams.name=row.name;
      listTracking(this.queryParams).then(response=>{
        console.log("aaaaaaaaaaaaaaaaa");
        console.log(response);
        console.log("aaaaaaaaaaaaaaaaa");

        this.studentTrackingList=response.rows;
        this.total = response.total;
      })
    },
    // 跟踪确认按钮
    submitForm3(){
      var param = Object.assign(this.form);
      console.log(param,"===========");
      updatesmTracking(param).then(response=>{
        this.$modal.msgSuccess("跟踪成功");
        this.open3 = false;
        this.getList();
      })
    },
    // 跟踪
    following(){
      const id = this.ids;
      getTracking(id).then(response=>{
        this.form = response.data;
        this.open3 = true;
      })


    },
    /** 查询学员跟踪列表 */
    getList() {
      this.loading = true;
      listTracking(this.queryParams).then(response => {
        this.trackingList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel3(){
      this.open3 = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        name: null,
        age: null,
        wechat: null,
        qq: null,
        phoneNumber: null,
        gender: null,
        intendedSubject: null,
        interestLevel: null,
        inputterTeacher: null,
        consultant: null,
        inputTime: null,
        lastFollowUpTime: null,
        intendedClass: null,
        source: null,
        education: null,
        graduationFromUniversity: null,
        graduationTime: null,
        reference: null,
        seniorStudents: null,
        speciality: null,
        yearsOfService: null,
        currentState: null,
        nextFollowUptime: null,
        trackingTimes: null,
        belongingToCampus: null,
        trackRecord: null,
        untracedTime: null,
        remarks:null,
        followUpPurpose:null,
        followUpMethod:null,
        contacte:null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加学员跟踪";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getTracking(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改学员跟踪";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateTracking(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addTracking(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除学员跟踪编号为"' + ids + '"的数据项？').then(function() {
        return delTracking(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('custom/tracking/export', {
        ...this.queryParams
      }, `tracking_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style scoped>
.row-flex {
  display: flex;
  flex-wrap: wrap;
}

.flex-item {
  flex: 1 0 calc(33.33% - 20px); /* 每个表单项占据三分之一宽度，减去间距 */
  margin-left: 20px;
  margin-bottom: 20px;
}

</style>
